import config


class ApproveTrustApi:

    # 1.实名认证
    @classmethod
    def approve(cls,session,realname,card_id):
        url = config.Host + "/member/realname/approverealname"
        body = {"realname":realname,"card_id":card_id}
        resp = session.post(url=url,data=body,files = {"x":"y"})
        return resp

    # 2.获取认证信息
    @classmethod
    def get_approve_info(cls,session):
        url = config.Host + "/member/member/getapprove"
        resp = session.post(url=url)
        return resp

    # 3.后台开户
    @classmethod
    def trust(cls,session):
        url = config.Host + "/trust/trust/register"
        resp = session.post(url=url)
        return resp


    # 4.获取充值验证码
    @classmethod
    def get_recharge_code(cls,session,r):
        url = config.Host + "/common/public/verifycode/{r}"
        resp = session.get(url=url)
        return resp


    # 5.后台充值
    @classmethod
    def recharge(cls,session,amount,valicode):
        url = config.Host + "/trust/trust/recharge"
        header = {"Content-Type":"application/x-www-form-urlencoded"}
        body = {"paymentType":"chinapnrTrust","amount":"1000","formStr":"reForm","valicode":"valicode"}
        resp = session.post(url=url,headers = header,data=body)
        return resp
